<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    //封装队列
    function Queue(){
        //属性
        this.items = []

        Queue.prototype.enqueue = function (element){
             this.items.push(element)
        }

        Queue.prototype.dequeue = function (){
            return this.items.shift()
        }

        Queue.prototype.front = function (){
            return this.items[0]
        }

        Queue.prototype.isEmpty = function (){
            return this.items.length == 0;
        }

        Queue.prototype.size = function (){
            return this.items.length
        }
    }
</script>
</body>
</html>